package com.baturu.vin.dfpv.dal.dao;

import com.baturu.vin.dfpv.dto.DfpvPartsMappingDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * @Author: chenjiahao
 * @Time: 2018/9/3
 */
public interface DfpvPartsMappingDAO {

    @Select({"<script>",
            "Select series, btrPartsName, partsCode",
            "FROM dfpv_parts_mapping",
            "WHERE series = #{series}",
            "AND btrPartsName in ",
            "<foreach item='item' index = 'index' collection='btrPartsName' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<DfpvPartsMappingDTO> queryPartsMappingBySeriesAndBtrPartsName(@Param("series") String series, @Param("btrPartsName") Set<String> btrPartsName);

    @Select({"<script>",
            "Select series, btrPartsName, partsCode",
            "FROM dfpv_parts_mapping",
            "WHERE series = #{series}",
            "AND partsCode in ",
            "<foreach item='item' index = 'index' collection='partsCode' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<DfpvPartsMappingDTO> queryPartsMappingBySeriesAndPartsCode(@Param("series") String series, @Param("partsCode") Set<String> partsCode);
}
